--File ： ChapterView.lua
--Author : zee
--Date   : 2015/4/8
--Description : 主界面，从scene来，用于组织所有的layer，层级等等。




PlayRuleNode = class("PlayRuleNode",function()
    -- 继承
    local ret = cc.Layer:create()

    ret.start = nil
    return ret
end)

PlayRuleNode.__index = PlayRuleNode


function PlayRuleNode:create()
    local ret = PlayRuleNode:new()
    return ret
end




--------------------------------------------------------
-- 初始化
--------------------------------------------------------
function PlayRuleNode:start()
    -- 
    local layer = cc.LayerColor:create()
    layer:setColor( cc.c3b(0,0,0) )
    layer:setOpacity( 255 )
    self:addChild( layer )

    self:makeUI()
end




function PlayRuleNode:makeUI()
    self.rootNode = cc.CSLoader:createNode("csb/play/playRule.csb")
    self:addChild( self.rootNode )

    -- bar move
    self.bar = SearchChildByName( self.rootNode, "bar")
    local endPos = cc.p( self:getPosition() )
    self:setPosition( self:getPositionX(), 1080+1080 )
    local mov = cc.MoveTo:create( 0.3, endPos )
    self:runAction( mov )

    --  event
    self.btn_full = SearchChildByName( self.rootNode, "base" )
    local function clickEvt()
        Sound(9)
        self:removeFromParent()
    end
    AddTouchEvent( self.btn_full,  clickEvt, UI:getInstance(),  nil, nil, nil )

end






















